package test.my.com.myapplicationtest.write_view;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Environment;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;

import java.io.File;
import java.io.IOException;

import test.my.com.myapplicationtest.R;
import test.my.com.myapplicationtest.paint_view.PaintAttributeModel;

/**
 * Created by ThinkPad on 2016/3/11.
 */
public class PaintViewActivity extends Activity {
    private FrameLayout container_fl;
    PaintPicView mPaintView_pv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.aty_paint_view_layout);
        String desPath = Environment.getExternalStorageDirectory() + File.separator + System.currentTimeMillis() + ".jpg";
//        String resPath = Environment.getExternalStorageDirectory() + File.separator + "banner.png";

        String resPath = Environment.getExternalStorageDirectory() + File.separator + "121.jpg";
//        mPaintView_pv = (PaintPicView) findViewById(R.id.mPaintView_pv);


//        PaintAttributeModel paintAttributeModel = new PaintAttributeModel.Builder()
//                .resPath(resPath)
//                .desPath(desPath)
//                .build();
//        mPaintView_pv.preparePaint(paintAttributeModel);

        DisplayMetrics metric = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(metric);
        int width = metric.widthPixels;  // 屏幕宽度（像素）
        int height = metric.heightPixels;  // 屏幕高度（像素）
        float density = metric.density;  // 屏幕密度（0.75 / 1.0 / 1.5）
        int densityDpi = metric.densityDpi;  // 屏幕密度DPI（120 / 160 / 240）

        Log.e("ah","屏幕宽度 metric.widthPixels == "+width);
        Log.e("ah","屏幕高度 metric.heightPixels == "+height);
        Log.e("ah","屏幕密度 metric.density == "+density);
        Log.e("ah","屏幕密度DPI metric.densityDpi == "+densityDpi);

    }

    public void build(View view){
        mPaintView_pv.saveDoneImage();
    }

    public void cancelPath(View view){
        mPaintView_pv.clearPath();
    }

    public void recoverPath(View view){
//        mPaintView_pv.recoverPath();
    }
}
